var obj = {
   person: {
     name: {
       firstName: 'Harry',
       lastName: 'Potter'
     }
   }
}

var fieldList = ['person', 'name', 'lastName'];


function getObjectField(obj, fieldList) {
  var name = fieldList.shift();
  if (fieldList.length) {
    return getObjectField(obj[name], fieldList)
  }
  else {
    return obj[name]
  }
}

function getObjectField02(obj, fieldList) {
    var str = 'obj' + fieldList.map(item => '["' + item + '"]').join('');
    return eval(str)
}

var result = getObjectField02(obj, fieldList)
console.log(result);